#!/usr/bin/expect -f
# 设置ssh连接的用户名
set user root
# 设置ssh连接的host地址
set host 192.168.11.20
# 设置ssh连接的登录密码
set password cloudroom123

#项目路径
set projectPath /home/docker-lwy/



#登录远端
spawn ssh $user@$host
expect "*password:"
send "$password\r"


#进入远端项目目录
expect "]*"
send "cd $projectPath && ./start-compose.sh\r"


expect "]*"
send "exit\r"

# 控制权移交
interact